package com.ocom.payconfig.controller;

import com.alibaba.fastjson.JSON;
import com.ocom.common.constant.PayConfigUrl;
import com.ocom.common.request.payconfig.GetOrderForecastDetailRequest;
import com.ocom.common.request.payconfig.GetOrderForecastMealNoRequest;
import com.ocom.common.request.payconfig.UpdateOrderForecastDetailRequest;
import com.ocom.common.resp.Result;
import com.ocom.payconfig.service.ForecastDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Slf4j
@RestController
public class ForecastDataController {
    @Autowired
    private ForecastDataService forecastDataService;
    @PostMapping(PayConfigUrl.URL_updateOrderForecastDetail)
    public Result updateOrderForecastDetail(@RequestBody UpdateOrderForecastDetailRequest request){
        log.info("批量订餐1xxxx：【{}】", JSON.toJSONString(request));
        return this.forecastDataService.updateOrderForecastDetail(request.getComId(),request);
    }

    @PostMapping(PayConfigUrl.URL_getOrderForecastMealNo)
    public Result getOrderForecastMealNo(@RequestBody GetOrderForecastMealNoRequest request){
        return this.forecastDataService.getOrderForecastMealNo(request.getComId(),request);
    }

    @PostMapping(PayConfigUrl.URL_getOrderForecastDetail)
    public Result getOrderForecastDetail(@RequestBody GetOrderForecastDetailRequest request){
        return this.forecastDataService.getOrderForecastDetail(request.getComId(), request);
    }

}
